<template>
</template>

<script>
</script>

<style>
</style>
<template>
	<view class="u-demo" style="margin-top: 30upx;">
		<view class="u-demo-wrap">
			<view class="u-demo-area">
				<u-steps :direction="direction" :current="current" :list="steps" :mode="mode" :icon="icon"></u-steps>
			</view>
		</view>
		<view class="wrap" v-show="current===0" style="margin-left: 30upx;">
			<u-form :model="model" :rules="rules" ref="uForm" :errorType="errorType">
				<u-form-item :rightIconStyle="{color: '#888', fontSize: '32rpx'}" :label-position="labelPosition"
					label="标题" label-width="150">
					<u-input :border="border" placeholder="标题" v-model="title" type="text"></u-input>
				</u-form-item>
				<u-form-item :rightIconStyle="{color: '#888', fontSize: '32rpx'}" :label-position="labelPosition"
					label="报警类别" label-width="150">
					<u-input :border="border" placeholder="报警类别" v-model="typeid" type="text" disabled="disabled">
					</u-input>
				</u-form-item>
				<!-- 				<u-form-item label="报警内容">
					<bgyxedit @bgyxchange="getInfo" :taskinfodtv="c" :showdone="true"
						uploadurl="http://121.41.88.175:8080/common/upload">
					</bgyxedit>

				</u-form-item> -->
				<u-form-item label="报警内容">
					<!-- 	<view class="u-content">
						<u-parse :content="content"></u-parse>
					</view> -->
					<view class="uni-common-mt" style="background:#FFF; padding:20rpx;">
						<rich-text :nodes="content"></rich-text>
					</view>
				</u-form-item>


			</u-form>
		</view>
		<u-row gutter="16" style="margin-top: -10upx;">
			<u-col span="6" text-align="center">
				<u-button @click="submit1">提交</u-button>
			</u-col>
		</u-row>
		<u-toast ref="uToast" />
	</view>
	</view>
</template>

<script>
	import bgyxedit from "@/pages/compoents/bgyxedit/bgyxedit.vue"
	export default {
		components: {
			bgyxedit
		},
		data() {
			return {
				//下拉
				array: [],
				list1: [],
				index: 0,
				show: true, //模态框
				action: undefined,
				fileList: [],
				type: 0,
				steps: [{
					name: '填写报警信息'
				}],
				current: 0,
				icon: 'checkmark',
				mode: 'number',
				direction: 'row',
				model: {},
				rules: {},
				border: false,
				check: false,
				selectStatus: 'close',
				actionSheetShow: false,
				pickerShow: false,
				selectShow: false,
				radioCheckWidth: 'auto',
				radioCheckWrap: false,
				labelPosition: 'left',
				codeTips: '',
				errorType: ['message'],
				type: [{}],
				typeid: '',
				position: '',
				content: '',
				title: '',
				c: [{
					type: 'text',
					value: '',
					f: false
				}],
			}
		},
		created() {
			// this.axios({
			//     method:"get",
			//     url:"http://localhost:8080/front/alarm/detail?studentId="+uni.getStorageSync('Id') + "&alarmId="+,
			// }).then((res)=>{
			// 	this.title = res.data.data.alarmTitle;

			// 	})
			//if(res.

		},
		onLoad(optation) {
			this.axios.get('http://localhost:8080/system/dict/data/type/alarm_type').then((res) => {
				this.type = res.data.data;
				console.log(this.type)
			})

			this.axios({
				method: "get",
				url: "http://localhost:8080/front/alarm/detail?studentId=" + uni.getStorageSync('Id') +
					"&alarmId=" + optation.alarmId,
			}).then((res) => {

				if (res.status === 200) {
					this.title = res.data.data.alarmTitle;
					this.content = res.data.data.alarmContent;
					this.c[0].value = this.content;
					this.typeid = this.alType(res.data.data.alarmType);
					this.state = res.data.data.alarmState;
					this.type1 = res.data.data.alarmType
					this.id = optation.alarmId 
				}
				console.log(this.content)
			})
		},

		methods: {
			submit1() {
				this.axios.post("http://localhost:8080/front/alarm/update?id=" + this.id + "&title=" + this
								.title + "&content=" + this.content + "&state=" + this.state + "&type=" + this.type1
				).then((res) => {
					console.log(res.data)
					if (res.status === 200) {

					}
				})

			},
			alType(id) {
				return this.type[id].dictLabel
			}
		}
	}
</script>

<style lang="scss" scoped>
	.u-content {
		padding: 24rpx;
	}
</style>
